<template>
  <div class="errPage-container">
    <el-button
      v-if="!showButton"
      icon="el-icon-arrow-left"
      class="back-btn"
      @click="back"
    >
      登录
    </el-button>
    <el-row>
      <el-col :span="12">
        <h1 class="text-jumbo text-ginormous">
          Oops!
        </h1>
        您好，{{ name }}
        <h2 v-if="!showButton">您目前没有任何权限</h2>
        <h2 v-else>该功能暂未对试用用户开放</h2>
        <h5>开通权限请联系超级管理员</h5>
        <!-- <ul class="list-unstyled">
          <li>或者你可以去:</li>
          <li class="link-type">
            <router-link to="/dashboard">
              回首页
            </router-link>
          </li>
          <li class="link-type">
            <a href="https://github.com/armour">随便看看</a>
          </li>
          <li>
            <a href="#" @click.prevent="dialogVisible = true">点我看图</a>
          </li>
        </ul> -->
      </el-col>
      <el-col :span="12">
        <img
          :src="errGif"
          class="some-gif"
          width="313"
          height="428"
          alt="Girl has dropped her ice cream."
        />
      </el-col>
    </el-row>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import errGif from '@/assets/401-images/401.gif'
import { UserModule } from '@/store/modules/user'
import defaultSettings from '@/settings'
@Component({
  name: 'Page401'
})
export default class extends Vue {
  private errGif = errGif + '?' + +new Date()
  get name() {
    return UserModule.name
  }
  get showButton() {
    return defaultSettings.multiplexComp.some(item => {
      return item.regExp.test(this.$route.path)
    })
  }
  private async back() {
    await UserModule.LogOut()
    this.$router.push(`/login`)
  }
  mounted() {
    console.log(this.$route)
  }
}
</script>

<style lang="scss" scoped>
.errPage-container {
  width: 800px;
  max-width: 100%;
  margin: 100px auto;

  .back-btn {
    background: #008489;
    color: #fff;
    border: none !important;
  }

  .some-gif {
    margin: 0 auto;
    display: block;
  }

  .some-img {
    display: block;
    margin: 0 auto;
    width: 100%;
  }

  .text-jumbo {
    font-size: 60px;
    font-weight: 700;
    color: #484848;
  }

  .list-unstyled {
    font-size: 14px;

    li {
      padding-bottom: 5px;
    }

    a {
      color: #008489;
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    }
  }
}
</style>
